package cn.wolfcode.springboot_consumer._01_hello;

import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * 消费者：
 *      1.消费者交给Spring管理
 *      2.类上贴 RocketMQMessageListener 消息中间件的监听注解
 *      3.类要实现 RocketMQListener 接口
 *      4.onMessage 方法：对消息的具体处理
 */

@Component
@RocketMQMessageListener(
        consumerGroup = "boot-consumer-demo",
        topic = "01-boot-hello"
)
public class Consumer implements RocketMQListener<String>{

    //消费者对消息的具体处理
    @Override
    public void onMessage(String msg) {
        System.out.println("消息内容：" + msg);
    }
}
